﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Calculator
{
    public partial class FormCalculator : Form
    {
        public static bool firstPart = true;
        public static decimal firstOperand = 0m;
        public static decimal secondOperand = 0m;
        public static char operation;

        public FormCalculator()
        {
            InitializeComponent();
        }

        private void buttonZero_Click(object sender, EventArgs e)
        {
            if (textBoxExpression.Text.Length > 0)
            {
                textBoxExpression.AppendText("0");
            }
        }

        private void buttonPoint_Click(object sender, EventArgs e)
        {
            textBoxExpression.AppendText(".");
        }

        private void buttonOne_Click(object sender, EventArgs e)
        {            
            if (textBoxExpression.Text != "0")
            {
                textBoxExpression.AppendText("1");
            }
            else
            {
                textBoxExpression.Text = "1";
            }
        }

        private void buttonTwo_Click(object sender, EventArgs e)
        {            
            if (textBoxExpression.Text != "0")
            {
                textBoxExpression.AppendText("2");
            }
            else
            {
                textBoxExpression.Text = "2";
            }
        }

        private void buttonTree_Click(object sender, EventArgs e)
        {
            if (textBoxExpression.Text != "0")
            {
                textBoxExpression.AppendText("3");
            }
            else
            {
                textBoxExpression.Text = "3";
            }
        }

        private void buttonFour_Click(object sender, EventArgs e)
        {            
            if (textBoxExpression.Text != "0")
            {
                textBoxExpression.AppendText("4");
            }
            else
            {
                textBoxExpression.Text = "4";
            }
        }

        private void buttonFive_Click(object sender, EventArgs e)
        {
            textBoxExpression.AppendText("5");
            if (textBoxExpression.Text != "0")
            {
                textBoxExpression.AppendText("5");
            }
            else
            {
                textBoxExpression.Text = "5";
            }
        }

        private void buttonSix_Click(object sender, EventArgs e)
        {
            if (textBoxExpression.Text != "0")
            {
                textBoxExpression.AppendText("6");
            }
            else
            {
                textBoxExpression.Text = "6";
            }
        }

        private void buttonSeven_Click(object sender, EventArgs e)
        {            
            if (textBoxExpression.Text != "0")
            {
                textBoxExpression.AppendText("7");
            }
            else
            {
                textBoxExpression.Text = "7";
            }
        }

        private void buttonEight_Click(object sender, EventArgs e)
        {            
            if (textBoxExpression.Text != "0")
            {
                textBoxExpression.AppendText("8");
            }
            else
            {
                textBoxExpression.Text = "8";
            }
        }

        private void buttonNine_Click(object sender, EventArgs e)
        {
            if (textBoxExpression.Text != "0")
            {
                textBoxExpression.AppendText("9");
            }
            else
            {
                textBoxExpression.Text = "9";
            }
        }

        private void buttonDel_Click(object sender, EventArgs e)
        {
            if (textBoxExpression.Text.Length > 0 && textBoxExpression.Text != "0")           
            {
                textBoxExpression.Text = textBoxExpression.Text.Substring(0, textBoxExpression.Text.Length - 1);
            }
        }

        private void buttonPlus_Click(object sender, EventArgs e)
        {
            if
        }
    }
}
